#ifndef INC_ENTITY_H_
#define INC_ENTITY_H_

#include <cassert>
#include <d3dx9math.h>

//-----------------------------------------------------------------------------
class TEntity3D {

	D3DXMATRIX  world;

	//D3DXVECTOR3 pos;
	//D3DXVECTOR3 front;
	//D3DXVECTOR3 left;
	//D3DXVECTOR3 up;
	//float       scale;

public:

	const D3DXMATRIX &getWorld() const { return world; }
	void setWorld( const D3DXMATRIX &new_world );

	void setPosition( const D3DXVECTOR3 &new_pos );
	void move( const D3DXVECTOR3 &delta );
	void rotate( const D3DXVECTOR3& axis, float radians );
	void rotateY( float radians );

	bool isInsideVisionCone( const D3DXVECTOR3& loc, float half_fov, const D3DXVECTOR3& loc_or,float zfar ) const;
	float getDistanceTo( const D3DXVECTOR3& loc ) const;
	float getAngleToPoint( const D3DXVECTOR3& loc ) const;

	const D3DXVECTOR3 &getPosition() const;
	const D3DXVECTOR3 &getFront( ) const;
	const D3DXVECTOR3 &getLeft( ) const;
	const D3DXVECTOR3 &getUp( ) const;

	// ---------------------------
	TEntity3D( );

	virtual ~TEntity3D( ) { }

	virtual void render( );
private:
	float calDist( D3DXVECTOR3& loc_or,  D3DXVECTOR3& loc_dest);
};

#endif
